﻿<%@ Page Title="" Language="C#" MasterPageFile="~/ANMCMaster.Master" AutoEventWireup="true" CodeBehind="Announcements.aspx.cs" Inherits="AllNations.UI.Announcements" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ANHeaderContent" runat="server">
    <script type="text/javascript">
        function AddAnnouncement() {
            var frm = document.getElementById('<%= panelAddNewAnnouncement.ClientID %>');
            if (frm.style["display"] == "none") {
                frm.style["display"] = "block";
                var txtAnnouncementTitle = document.getElementById('<%= txtAnnouncementTitle.ClientID %>');
                txtAnnouncementTitle.focus();
            } else
                frm.style["display"] = "none";
        }

        function ViewAnnouncementDetail(id) {
            var content = document.getElementById("content_" + id);
            if (content.style["display"] == "none")
                content.style["display"] = "block";
            else
                content.style["display"] = "none";
        }
    </script>
</asp:Content>
<asp:Content ID="ANPageHeader1" ContentPlaceHolderID="ANPageHeader" runat="server">
    <asp:Image ID="mainImage" runat="server" ImageUrl="~/Images/worship_main.png" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ANBodyContent" runat="server">
    <div class="leftnav">
        <telerik:RadMultiPage ID="LeftNavigationViews" runat="server" RenderSelectedPageOnly="true">
            <telerik:RadPageView ID="viewMain" runat="server">
                <div style="margin: 11px 0px 25px 0px;"><asp:Image ID="Image6" runat="server" ImageUrl="~/Images/sectionTitleFellowship.png" /></div>
                <telerik:RadMenu ID="radMenuLeftNavMain" runat="server" EnableEmbeddedSkins="false" Skin="ANMCLeftNav">
                    <Items>
                        <telerik:RadMenuItem Text="교회소식" Value="Announcements" Selected="true"></telerik:RadMenuItem>
                        <telerik:RadMenuItem Text="주보" Value="SundayBulletin" NavigateUrl="~/FileShare/Main"></telerik:RadMenuItem>
                        <telerik:RadMenuItem Text="앨범" Value="PhotoAlbum" NavigateUrl="~/PhotoAlbum/Main"></telerik:RadMenuItem>
                        <telerik:RadMenuItem Text="행사계획" Value="UpcomingEvents" NavigateUrl="~/Fellowship?UpcomingEvents"></telerik:RadMenuItem>
                        <telerik:RadMenuItem Text="목장사역" Value="SmallGroups" NavigateUrl="~/Fellowship?SmallGroups"></telerik:RadMenuItem>
                    </Items>
                </telerik:RadMenu>
            </telerik:RadPageView>
            <telerik:RadPageView ID="viewYouthGroup" runat="server">
                <style type="text/css">
                    table.anmcList td {
                        font-family: Arial, Helvetica, sans-serif !important;
                        font-size: 9pt !important;
                    }
                </style>
                <div style="margin: 11px 0px 25px 0px;"><asp:Image ID="Image2" runat="server" ImageUrl="~/Images/sectionTitleYouthGroupHome.png" /></div>
                <telerik:RadMenu ID="radMenuLeftNavYouthGroup" runat="server" EnableEmbeddedSkins="false" Skin="ANMCLeftNav">
                    <Items>
                        <telerik:RadMenuItem Text="Home" Value="Home" NavigateUrl="~/YouthGroup"></telerik:RadMenuItem>
                        <telerik:RadMenuItem Text="Announcements" Value="Announcements" Selected="true"></telerik:RadMenuItem>
                        <telerik:RadMenuItem Text="Messageboard" Value="Messageboard" NavigateUrl="~/Shoutout/YouthGroup"></telerik:RadMenuItem>
                    </Items>
                </telerik:RadMenu>
            </telerik:RadPageView>
        </telerik:RadMultiPage>
    </div>
    <div class="rightcontentarea">
        <div id="contentBoxHolder">
            <div class="ContentTitleBar">
                <asp:Image ID="Image7" runat="server" ImageUrl="~/Images/titleAnnouncements.png" />
            </div>
            <article class="node static-page content">
                <asp:Panel ID="panelAddNewAnnouncement" runat="server" style="display:none">
                    <asp:HiddenField ID="hidAnnouncementId" runat="server" />
                    <table cellpadding="0" cellspacing="0" border="0">
                        <tr>
                            <td style="padding: 4px; font-size: 0.95em;">Headline:</td>
                            <td style="padding: 4px;"><asp:TextBox ID="txtAnnouncementTitle" runat="server" CssClass="FieldR2" Width="400px" /></td>
                        </tr>
                        <tr>
                            <td style="padding: 4px; font-size: 0.95em;">Announcement:</td>
                            <td style="padding: 4px;"><asp:TextBox ID="txtAnnouncement" runat="server" CssClass="FieldR2" Rows="5" Width="400px" TextMode="MultiLine" /></td>
                        </tr>
                        <tr>
                            <td style="padding: 4px; font-size: 0.95em;">Effective From:</td>
                            <td style="padding: 4px;"><telerik:RadDateTimePicker ID="RadDateTimePickerFrom" runat="server" /></td>
                        </tr>
                        <tr>
                            <td style="padding: 4px; font-size: 0.95em;">Effective To:</td>
                            <td style="padding: 4px;"><telerik:RadDateTimePicker ID="RadDateTimePickerTo" runat="server" /></td>
                        </tr>
                        <tr>
                            <td style="padding: 4px;">&nbsp;</td>
                            <td style="padding: 4px;">
                                <asp:Button ID="btSaveAnnouncement" runat="server" Text="Submit" />
                                <asp:Button ID="btCancelSave" runat="server" Text="Cancel" OnClientClick="AddAnnouncement(); return false;" />
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
                <asp:Repeater ID="rptAnnouncement" runat="server">
                    <HeaderTemplate>
                        <table cellpadding="0" cellspacing="0" border="0" class="anmcList">
                        <tr class="header">
                            <td style="width: 425px"><asp:Label ID="lblAnnouncement" runat="server" Text="제목" Font-Bold="true" OnPreRender="lblAnnouncement_PreRender" /></td>
                            <td><asp:Label ID="lblAnnouncementDate" runat="server" Text="날짜" Font-Bold="true" OnPreRender="lblAnnouncementDate_PreRender" /></td>
                            <td runat="server" visible='<%# IsPageAdministrator() %>'><asp:Label ID="lblAdminMenu" runat="server" Text="관리" Font-Bold="true" OnPreRender="lblAdminMenu_PreRender" /></td>
                        </tr>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <tr runat="server" OnPreRender="AnnouncementRow_PreRender">
                            <td style="width: 425px">
                                <asp:HyperLink runat="server" Text='<%# Eval("announcement_title_txt") %>' NavigateUrl='<%# string.Format("javascript:ViewAnnouncementDetail(\"{0}\"); void(0);", Eval("announcement_id")) %>' ForeColor="Black" /><br />
                                <div id='<%# string.Format("content_{0}", Eval("announcement_id")) %>' style="display: none; width: 400px; background-color: #f0f0f0; margin-top: 5px; padding: 10px;"><%# FormatAnnouncement(Eval("announcement_txt").ToString()) %></div>
                            </td>
                            <td><%# Eval("display_dttm", "{0:d}")%></td>
                            <td style="white-space: nowrap;" runat="server" visible='<%# IsPageAdministrator() %>'>
                                <asp:LinkButton ID="lnkDelete" runat="server" OnClick="lnkDelete_Click" OnClientClick="if (!confirm('You are about to delete a file, click OK to continue.')) return false;" CommandArgument='<%# Eval("announcement_id") %>'><asp:Image ID="Image2" runat="server" ImageUrl="~/Images/delete.gif" ImageAlign="AbsMiddle" style="float: left" />&nbsp;Delete</asp:LinkButton>
                            </td>
                        </tr>
                    </ItemTemplate>
                    <FooterTemplate>
                        </table>
                        <asp:Panel ID="panelAdminNote" runat="server" Visible='<%# IsPageAdministrator() %>' style="margin: 15px 0px;">
                            <table cellpadding="0" cellspacing="0" border="0" style="height: 16px;">
                                <tr>
                                    <td style="border: 1px solid #000; background-color: #ffcc66; width: 16px">&nbsp;</td>
                                    <td style="padding-left: 10px; font-family: Arial,Helvetica,Sans-serif">Highlighted row indicates scheduled announcements.  They are only visible to the admin users.</td>
                                </tr>
                            </table>
                        </asp:Panel>
                    </FooterTemplate>
                </asp:Repeater>
            </article>
        </div>
        <div style="clear: both;"></div>
    </div>
    <div style="clear: both;"></div>
</asp:Content>
